<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Unix)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGED" CONTENT="20110101;15242700">
	<STYLE TYPE="text/css">
	<!--
		@page { margin: 0.79in }
		P { margin-bottom: 0.08in }
		PRE { font-family: "Times New Roman" }
	-->
	</STYLE>
</HEAD>
<BODY LANG="el-GR" DIR="LTR">
<PRE>
<FONT SIZE=5><SPAN LANG="en-US"><B>qrisngvaldec</B></SPAN></FONT>

<FONT SIZE=4><SPAN LANG="en-US">Singular Value Decomposition,</SPAN></FONT>
<FONT SIZE=4><SPAN LANG="en-US"><SPAN STYLE="font-style: normal">for</SPAN> details see book of Hang T. Lau, “A Java Numerical Library for Scientists and engineers|”, Chapman &amp; Hall, 2004</SPAN></FONT>

<FONT SIZE=4><SPAN LANG="en-US"><B>Example: Can be run with F5 within the ScalaLab Editor (Ctrl-E to open the editor)</B></SPAN></FONT>



import java.text.DecimalFormat;
import numal.*;

public class Test_qrisngvaldec extends Object {
	
	public static void main(String args[]) {

    int i,j;
    double val[] = new double[6];
    double em[] = new double[8];
    double a[][] = new double[7][6];
    double v[][] = new double[6][6];

    for (i=1; i&lt;=6; i++)
      for (j=1; j&lt;=5; j++) a[i][j]=1.0/(i+j-1);
    em[0]=1.0e-6;  em[2]=1.0e-5;  em[4]=25.0;  em[6]=1.0e-5;
    i=Linear_algebra.qrisngvaldec(a,6,5,val,v,em);
    DecimalFormat fiveDigit = new DecimalFormat(&quot;0.00000E0&quot;);
    System.out.println(&quot;Number of singular values not found :  &quot; +
      i + &quot;\n\nInfinity norm :  &quot; + fiveDigit.format(em[1]) +
      &quot;\nMax neglected subdiagonal element :  &quot; + 
      fiveDigit.format(em[3]) +
      &quot;\nNumber of iterations :  &quot; + (int)em[5] +
      &quot;\nNumerical rank :  &quot; + (int)em[7] +
      &quot;\n\nSingular values :&quot;);
    for (i=1; i&lt;=5; i++)
      System.out.println(&quot;  &quot; + fiveDigit.format(val[i]));
    System.out.println(&quot;\nMatrix U, first 3 columns :&quot;);
    for (i=1; i&lt;=6; i++)
      System.out.println(&quot;  &quot; +
        fiveDigit.format(a[i][1]) + &quot;\t&quot; +
        fiveDigit.format(a[i][2]) + &quot;\t&quot; +
        fiveDigit.format(a[i][3]));
    System.out.println(&quot;Last 2 columns :&quot;);
    for (i=1; i&lt;=6; i++)
      System.out.println(&quot;  &quot; +
        fiveDigit.format(a[i][4]) + &quot;\t&quot; +
        fiveDigit.format(a[i][5]));
	}
}
</PRE>
</BODY>
</HTML>